package cn.liutao.order.entity.po;

import cn.liutao.common.entity.BaseEntity;
import cn.liutao.common.entity.Validation;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotNull;

/**
 * 购物车表 实体类。
 *
 * @author liutao
 * @since 2023-11-01
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(value = "cart")
public class Cart extends BaseEntity implements Serializable {

    @Id(keyType = KeyType.Auto)
    @NotNull(message = "请选择购物车",groups = Validation.EditGroup.class)
    private Integer id;

    /**
     * 关联用户
     */
    @JsonIgnore
    private Integer userId;

    /**
     * 关联菜品
     */
    @NotNull(message = "请选择对应的菜品",groups = Validation.AddGroup.class)
    private Integer dishId;

    /**
     * 关联口味
     */
    @NotNull(message = "请选择对应的口味",groups = Validation.AddGroup.class)
    private Integer tasteId;

    /**
     * 0直接购买，1购物车购买
     */
    private Integer type = 0;

    /**
     * 加入购物车后的总价格
     */
    private BigDecimal price;

    /**
     * 下单数量
     */
    @NotNull(message = "下单数量不能为空",groups = Validation.AddGroup.class)
    private Integer quantity;

    /**
     * 已下单、未下单0：未下单，1：已下单
     */
    private Integer status;



}
